package java_test.reflection;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class MethodTest {
    public static void main(String[] args) {
        Class clazz = Person1.class;
//        Method[] methods = clazz.getMethods();
//        for (Method m : methods) {
//            System.out.println(m);
//        }
//        System.out.println();
        Method[] declaredMethods = clazz.getDeclaredMethods();
//        for (Method m : declaredMethods) {
//            System.out.println(m);
//        }
        for (Method m : declaredMethods) {
//            Annotation[] annotations = m.getAnnotations();
//            for (Annotation a : annotations) {
//                System.out.println(a);
//            }
            //System.out.println(Modifier.toString(m.getModifiers()) + "\t");
            //System.out.println(m.getReturnType());
            System.out.print(m.getName());
            System.out.print("(");
            Class[] parameterTypes = m.getParameterTypes();
            if (!(parameterTypes == null && parameterTypes.length == 0)) {
                for (Class p : parameterTypes) {
                    System.out.print(p.getName() + " args_");
                }
            }
            System.out.println(")");
        }
    }
}
